home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1435 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.7 KB  |  73 lines

  1. Newsgroups: comp.lang.c++
  2. Path: twisto.eng.hou.compaq.com!news
  3. From: Saurabh Dixit <saurabhd@bangate.compaq.com>
  4. Subject: Re: Is this code valid?
  5. Message-ID: <30F43E85.7C9B@bangate.compaq.com>
  6. Sender: news@twisto.eng.hou.compaq.com (System Administrator)
  7. Mime-Version: 1.0
  8. X-Mailer: Mozilla 2.0b2 (Windows; I; 32bit)
  9. Content-Type: text/plain; charset=us-ascii
  10. Organization: Compaq Computer Corporation
  11. Date: Wed, 10 Jan 1996 22:32:37 GMT
  12. References: <30F3E42D.74BA@sto.fdata.se>
  13. X-Nntp-Posting-Host: 172.18.176.8
  14. Content-Transfer-Encoding: 7bit
  15.  
  16. Niklas Mellin wrote:
  17. > class X
  18. > {
  19. >   public:
  20. >   class Y;
  21. > };
  22. > class X::Y
  23. > {
  24. > };
  25. > int main(int, char* [])
  26. > {
  27. >   throw X::Y();
  28. >   return 0;
  29. > }
  30. > It doesn't matter if the throw statement is in main or in 
  31. some
  32. > other function, and it makes no difference if there is a 
  33. catch
  34. > statement.
  35. > When linking the code above in Borland C++ 4.0 the ide 
  36. crashes
  37. > killing windows too (it took me a while to isolate the 
  38. problem).
  39. > Borland 4.5 doesn't crash but reports: "Internal error..." 
  40. some
  41. > number.
  42. > My question: Is it allowed to throw objects of nested 
  43. classes?
  44. > ---
  45. > Niklas Mellin
  46.  
  47. Though I wouldn't expect a compiler to crash when it
  48. encounters possible bad code, I don't see what you are 
  49. trying to throw.
  50. Don't you need an object to throw?
  51. In the statement
  52. throw X::Y() where is the object?
  53.  
  54. -- 
  55. Saurabh Dixit
  56. "All opinions are always my own..."
  57. Compaq Computer Corporation
  58. --------------------------------------------------------------
  59. ----------
  60. Thou who sneezes without kerchief takes matters in own hands.
  61.             - SomeoneIOnceNew
  62. --------------------------------------------------------------
  63. ---------- 
  64. xxxx
  65.